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