UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rV5ZzDdPStvFeOdtmIb9yMSvEJCokvENiHgljy/iFk0='
WHERE
key_id = '7a8c1ea96b37771a5e6694006eee5def54b9bfda27f9fd8919d049455ee948e4'
AND (
token = 'rV5ZzDdPStvFeOdtmIb9yMSvEJCokvENiHgljy/iFk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)