UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N3BuDQUVE6UZFgN9T64IumIxwpFFG8gETHbJPLrsFDU='
WHERE
key_id = '17c3839e1e5335c45c0e3c857c2f6b23ffd99c69b7ed2955a18b90f3cf181846'
AND (
token = 'N3BuDQUVE6UZFgN9T64IumIxwpFFG8gETHbJPLrsFDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)