UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mw2l3BoJEGnrN14SdOUYSTebasUeXk/mAIP3hc6ey2U=' 
WHERE 
  key_id = '8f4e830f79159afb460ff9901965958a818aba663376694f0e00dc89d34574b6' 
  AND (
    token = 'Mw2l3BoJEGnrN14SdOUYSTebasUeXk/mAIP3hc6ey2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034