UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jktquCm3MeGO2z2UxalOVjPPFfezBETJJLilRmw48Ow=' 
WHERE 
  key_id = '43e83cadf676d038f565a6fbff4a8dec0a1204506e3209741541a882823c8b89' 
  AND (
    token = 'jktquCm3MeGO2z2UxalOVjPPFfezBETJJLilRmw48Ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034