UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kpwJSzzu9hOIq1xYgb0ABSNClnM6c+n9OoYnJRAzDME='
WHERE
key_id = 'c1f731068ed6204e91d36a18e7711a9bc1aca006d49e41927545ad686d581a36'
AND (
token = 'kpwJSzzu9hOIq1xYgb0ABSNClnM6c+n9OoYnJRAzDME='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)