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