UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9qDalf3rtOGQlhW7uaa4alqgu29X6kLT+5xs7Ek8mhA='
WHERE
key_id = 'c24b47943cd588b272e5126ae0e9368eb1235b473f4ec1a7e2770f3ef2e5d835'
AND (
token = '9qDalf3rtOGQlhW7uaa4alqgu29X6kLT+5xs7Ek8mhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)