UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iO/RdiwGYTduue9HaZYj7Le5Ut3lnNWRfXRqfU5sE1Y=' 
WHERE 
  key_id = '9ba6b4f348a50aa994d12d3b288d679a2e93b3ab7c9fc52cbeee6a3c70ed5f90' 
  AND (
    token = 'iO/RdiwGYTduue9HaZYj7Le5Ut3lnNWRfXRqfU5sE1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026