UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AxUCgZgmOZ9ZMOolA5E1RHDC7VaP/7tMhe5dNCgx1Hk='
WHERE
key_id = 'aa471e45d2d6f28abebdcf2f8cdf90b6a21681981cf2965d40af8c70a013cac3'
AND (
token = 'AxUCgZgmOZ9ZMOolA5E1RHDC7VaP/7tMhe5dNCgx1Hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)