UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2dFDF7OOG0WyHekd0JveBLs1EAPoClQj0X/Ry7ihLbw='
WHERE
key_id = 'f4f03f9c9d63ed8a41aa34777ff11a535f280dd647f280a2a423f6b1a71013de'
AND (
token = '2dFDF7OOG0WyHekd0JveBLs1EAPoClQj0X/Ry7ihLbw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)