UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qazwuX7F/D2dej8gD1aKjTEkeKcYxqTzLS4w+EZvRcI=' 
WHERE 
  key_id = 'c54a1ae840e4a4513f1bc53db72cb2641651e1e27b643c78602bff5234511add' 
  AND (
    token = 'qazwuX7F/D2dej8gD1aKjTEkeKcYxqTzLS4w+EZvRcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053