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