UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6k5oAvXZmy6UrNgcE750NwndTW3Z0FiKUf+HZ8Vh2cs='
WHERE
key_id = '515517f00e7301d81f79dc5bdfdfb4595b317c732f8bdf15fc071f1020821f2d'
AND (
token = '6k5oAvXZmy6UrNgcE750NwndTW3Z0FiKUf+HZ8Vh2cs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)