UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VzKm5iPtvSeXlA3R+HzbvXvz6FLeOSAlXHJabRhNlZw=' 
WHERE 
  key_id = '27c1207786e4e3a00bf5d8f24fb6d4e88e5f5b26e4d930e39e6ce25395753c00' 
  AND (
    token = 'VzKm5iPtvSeXlA3R+HzbvXvz6FLeOSAlXHJabRhNlZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037