UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KaEMyCaImu39lPMRxwnM5LS8TnEpzPvcj5/JA4g/gmE=' 
WHERE 
  key_id = '7b8f28a85047ed778911c6fe5be22f961388e492a069f4e68f8047bf23f22979' 
  AND (
    token = 'KaEMyCaImu39lPMRxwnM5LS8TnEpzPvcj5/JA4g/gmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035