UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKWpUXuFV2UtMMbBcV+t5jevDLgjef4NePqCyRfZ1uo=' 
WHERE 
  key_id = 'ad3965c2d8a21beaedfb39101ace496626b46e422cd92f783d40b318c22325ab' 
  AND (
    token = 'KKWpUXuFV2UtMMbBcV+t5jevDLgjef4NePqCyRfZ1uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029