UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'awMhG8HO9sxk4cI3NisVNfYQDCvl3XUe43YWbSVSjxo=' 
WHERE 
  key_id = '86509df538a1f9238a9b0fbf0a03b4979a3aaf2f41552797f3b49819b0f853eb' 
  AND (
    token = 'awMhG8HO9sxk4cI3NisVNfYQDCvl3XUe43YWbSVSjxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023