UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQuvjUYCl7T/tEbbaavfZq0vNp3bGyk0rjI11WgU+f8=' 
WHERE 
  key_id = '09ad21a9b4ce4f84bcda6941074a95305ca2940af29bd42a15b22df526629007' 
  AND (
    token = 'iQuvjUYCl7T/tEbbaavfZq0vNp3bGyk0rjI11WgU+f8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041