UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i0G1pnwydtJ3ZlUadPlQTBnS0q8ETB1UDSQWC6hnfX4=' 
WHERE 
  key_id = 'f96a823b0ccecf0efc1bd7db260f0f9acd1e426332e15235dde3ecc9d9e82b76' 
  AND (
    token = 'i0G1pnwydtJ3ZlUadPlQTBnS0q8ETB1UDSQWC6hnfX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043