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