UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wUanRAbYGn5jJqOzx5P6dEx7Gio6N9OwYB4wijvKfj4='
WHERE
key_id = 'a3615dde599eed135e86b5375686cbe453f9d9a5bf191a9766b279645b84b1b1'
AND (
token = 'wUanRAbYGn5jJqOzx5P6dEx7Gio6N9OwYB4wijvKfj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)