UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PyWjG+IZV143JWIudX8uWQFZSQfk1kbpJUR5N3Of8Us='
WHERE
key_id = '8105357e6ea723fb6916f83026d0140621bd5785db4e8985059d364a04887f1b'
AND (
token = 'PyWjG+IZV143JWIudX8uWQFZSQfk1kbpJUR5N3Of8Us='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)