UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l7J35M4FI5oFT/a58Al8DqQ823TpEErh3AP+xoffKTI=' 
WHERE 
  key_id = 'cf1a94540651e6637bf4149f1281d131cbe171dd7fa550757e75c933798aa453' 
  AND (
    token = 'l7J35M4FI5oFT/a58Al8DqQ823TpEErh3AP+xoffKTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036