UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iTwhpAjJc6r63ZgvPMxD5fgC1b5ackY2rULieaoWMgw='
WHERE
key_id = '149afc47404c5b2ea63be58af623b943995de6d885d993fb36c65a5059e399f0'
AND (
token = 'iTwhpAjJc6r63ZgvPMxD5fgC1b5ackY2rULieaoWMgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)