UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AnX+cKj7yg/FUN6BFmLQTc0TnmP8ZreU4DU+HAxJuhY=' 
WHERE 
  key_id = '4ddbe411f11dd388ee6fa3faf71e1f63ff6480703855aaf919022768199bda87' 
  AND (
    token = 'AnX+cKj7yg/FUN6BFmLQTc0TnmP8ZreU4DU+HAxJuhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050