UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oPdl02FA3BtA3E63cFqRID/V3xyUlpdxyVLIoEch/zw=' 
WHERE 
  key_id = '1e37dc5d66224ee6a0f77653dd5e501efc256d7c3629af0e95a1b061d0694016' 
  AND (
    token = 'oPdl02FA3BtA3E63cFqRID/V3xyUlpdxyVLIoEch/zw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025