UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nCQZjRR9pazfgU64cK6Gw6MUcIcD/+s56VESnGGTmco=' 
WHERE 
  key_id = '31d1dc1441129a2c7163cedc9e3ffc263ff3883d9eee5a21a8ceaccb88380d65' 
  AND (
    token = 'nCQZjRR9pazfgU64cK6Gw6MUcIcD/+s56VESnGGTmco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041