UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W5W9nF9UFswuMM+JmOiXGpqFpK6/6ztFYcJxEQbHofg='
WHERE
key_id = 'be868e21048993fd6597b3c9bd46d88372a72e79198a573a17402ca0d24f692c'
AND (
token = 'W5W9nF9UFswuMM+JmOiXGpqFpK6/6ztFYcJxEQbHofg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)