UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9iueOpUUcKg8dpmabTrOoY3MW/uPpC1ito34nL1DX0A=' 
WHERE 
  key_id = 'd308c809c5c2a9ff871b3693b44a07b1a860f079b4ea76adfaa30269ba671f55' 
  AND (
    token = '9iueOpUUcKg8dpmabTrOoY3MW/uPpC1ito34nL1DX0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047