UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5dqPfuIv+VoQKjqOEc4CWp1UfuC5RE00Ls4FJEyhz4Y=' 
WHERE 
  key_id = '05d73f0b9238981b0a6bf4d58f7d938cbb0e6dacbeacadbc9ad4ceab065e6380' 
  AND (
    token = '5dqPfuIv+VoQKjqOEc4CWp1UfuC5RE00Ls4FJEyhz4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046