UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y6a3QgdyWMGJNfo3WhA4pdLXS8JZcOvY8XUoIQWDP0w='
WHERE
key_id = '4f997255560c9b17eca7dda8d5db81ff501ea8884d69b0b20235b6522564fc04'
AND (
token = 'y6a3QgdyWMGJNfo3WhA4pdLXS8JZcOvY8XUoIQWDP0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)