UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bpAoCtELatXGv6fjK2DSPKWc++mGKAGpc0KdhLtecUo=' 
WHERE 
  key_id = '8f00b162f924bf7ad006054f807c70610382022fe9ab33fe0faf3fbd4a8183a6' 
  AND (
    token = 'bpAoCtELatXGv6fjK2DSPKWc++mGKAGpc0KdhLtecUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032