UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJaPQRJidP8+AAaUV82tIhJZM97Hkf2DbYU1+C1kRWw=' 
WHERE 
  key_id = '7df3dab236627bd6c4c54e78bc57df22a6d492735daa5448c065e91776d72472' 
  AND (
    token = 'AJaPQRJidP8+AAaUV82tIhJZM97Hkf2DbYU1+C1kRWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016