UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UiXPcZbgmcUKGNOo9896Xsq2AHuRWvGJvh89zII2tmk='
WHERE
key_id = 'c286e08395fb22f1855a3e1db85a840d592d54aa8996562ab0e175d84145cd32'
AND (
token = 'UiXPcZbgmcUKGNOo9896Xsq2AHuRWvGJvh89zII2tmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)