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