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