UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FuaIyzOECfjG488zE+XYqWdoM/4K+4Lc0Fr8xgFfX6g='
WHERE
key_id = 'a99b1919cd370209cf6b856cf7f865f8432972ba674eeec37eaa27a1b013e0de'
AND (
token = 'FuaIyzOECfjG488zE+XYqWdoM/4K+4Lc0Fr8xgFfX6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)