UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cv37j0oiz1papbqUrxHVWtN5YS2DtEDgX2/6wgtTtBw='
WHERE
key_id = '59c683e8f595e00c7424d8e659a3cffa7595a9f7bbb89e171ccef0f05d765767'
AND (
token = 'cv37j0oiz1papbqUrxHVWtN5YS2DtEDgX2/6wgtTtBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)