UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lHcjwBpGvfrABFECTTBqb1ypq3VrtvR12hJtfmUn+84=' 
WHERE 
  key_id = '88da7643b66fd89421c2533034d8aeb557ab280564c9ab1d3cf4321e48c7b9a9' 
  AND (
    token = 'lHcjwBpGvfrABFECTTBqb1ypq3VrtvR12hJtfmUn+84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026