UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B7sIObBre9qnCDSoq3x4DChzaSmez+78D94GlOuLoHM=' 
WHERE 
  key_id = '8e0107cc8d5a901248593ac18f8eff0061f13e6c85663ea888e329e8cdc7a45e' 
  AND (
    token = 'B7sIObBre9qnCDSoq3x4DChzaSmez+78D94GlOuLoHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022