UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qTtM+sh2jiAjSSViJfblTuANzglIgWHA0sZT3gYcQec='
WHERE
key_id = 'aad2b6144b644836a90ac3067b3d3e8fc2fad0fc67c6c259e35543452afa7f74'
AND (
token = 'qTtM+sh2jiAjSSViJfblTuANzglIgWHA0sZT3gYcQec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)